package git.soulbgm.pojo;

/**
 * 命令执行结果
 *
 * @author SoulBGM
 * @date 2022/11/25 16:49
 */
public class CmdResult {

    /**
     * 命令输出结果 当success=true时为成功的输出结果 当success=false时为失败的输出结果
     */
    private String output = "";

    /**
     * 是否成功
     */
    private boolean success = false;

    /**
     * 成功
     *
     * @param output 输出
     * @return {@link CmdResult}
     */
    public static CmdResult success(String output) {
        CmdResult result = new CmdResult();
        result.setSuccess(true);
        result.setOutput(output);
        return result;
    }

    /**
     * 错误
     *
     * @param output 输出
     * @return {@link CmdResult}
     */
    public static CmdResult error(String output) {
        CmdResult result = new CmdResult();
        result.setOutput(output);
        return result;
    }

    /**
     * 错误
     *
     * @return {@link CmdResult}
     */
    public static CmdResult error() {
        return new CmdResult();
    }

    public String getOutput() {
        return output;
    }

    public void setOutput(String output) {
        this.output = output;
    }

    public boolean isSuccess() {
        return success;
    }

    public void setSuccess(boolean success) {
        this.success = success;
    }
}
